window.onload = function() {
	//搜索框
	var oxx = document.getElementById('xx');
	var obanner = document.getElementById('top-banner');
	var otext = document.getElementById('textt');
	otext.onmousedown = function() {
		otext.value = '';
		otext.style.color = 'rgb(51, 51, 51)';
	};
	//鼠标监听事件
	var scrollTop=0,DOU=false;
    setInterval(function(){
        scrollTop=document.body.scrollTop
        if(!DOU&&scrollTop>400){
        	document.getElementById('top_search').style.display="block";
			document.getElementById('top_search').addEventListener("animationend", function() { document.getElementById('top_search').classList.remove("changeStyle_move_down"); }, false);
			document.getElementById('top_search').classList.add("changeStyle_move_down");
			document.getElementById('top_search').style.top="0";
			DOU=true;
        }else if(DOU&&scrollTop<=400){      	
			document.getElementById('top_search').addEventListener("animationend", function() { document.getElementById('top_search').classList.remove("changeStyle_move_up"); }, false);
			document.getElementById('top_search').classList.add("changeStyle_move_up");
			document.getElementById('top_search').style.top="-52px";
        	DOU=false;        	
        }
    },100)
}
//纯JS代码轮播图
var t, tt;
var k = 1;
var LB_side = 8;
var last = 1,
	next = 2;
t = setTimeout("show_lunbo()", "1500");
//底下圆圈事件
function on_qh(p) {
	last = k;
	k = p;
	var ii = "l_" + last;
	var pp = "on_" + last;
	if(last != p) {
		document.getElementById(ii).addEventListener("animationend", function() { document.getElementById(ii).classList.remove("changeStyle_hidden"); }, false);
		document.getElementById(ii).classList.add("changeStyle_hidden");
	}
	document.getElementById(ii).style.opacity = 0;
	document.getElementById(pp).style.background = "#fff";
	next = p;
	var ii = "l_" + next;
	var pp = "on_" + next;
	if(last != p) {
		document.getElementById(ii).addEventListener("animationend", function() { document.getElementById(ii).classList.remove("changeStyle_visible"); }, false);
		document.getElementById(ii).classList.add("changeStyle_visible");
	}
	document.getElementById(ii).style.opacity = 1;
	document.getElementById(pp).style.background = "#f00";
	k = p;
	clearTimeout(t);
}
//自动播放事件+左右切换事件
function show_lunbo(p) {
	clearTimeout(t);
	if(p == undefined) {
		last = k;
		if(k < LB_side)
			k++;
		else
			k = 1;
		t = setTimeout("show_lunbo()", "1500");
	} else {
		last = k;
		if(p == 1) {
			if(k > 1)
				k--;
			else
				k = LB_side;
		} else if(p == 2) {
			if(k < LB_side)
				k++;
			else
				k = 1;
		}
		clearTimeout(t);
	}
	next = k;
	var ii = "l_" + last;
	var pp = "on_" + last;
	document.getElementById(ii).addEventListener("animationend", function() { document.getElementById(ii).classList.remove("changeStyle_hidden"); }, false);
	document.getElementById(ii).classList.add("changeStyle_hidden");
	document.getElementById(ii).style.opacity = 0;
	document.getElementById(pp).style.background = "#fff";
	ii = "l_" + next;
	pp = "on_" + next;
	document.getElementById(ii).addEventListener("animationend", function() { document.getElementById(ii).classList.remove("changeStyle_visible"); }, false);
	document.getElementById(ii).classList.add("changeStyle_visible");
	document.getElementById(ii).style.opacity = 1;
	document.getElementById(pp).style.background = "#f00";
}
//鼠标离开继续自动播放事件
function show_run() {
	clearTimeout(t);
	t = setTimeout("show_lunbo()", "1500");
}
//鼠标离开继续自动播放事件
function stop_run() {
	clearTimeout(t);
}

//倒计时
var remain_time = 0;
var Second = 50,
	Minute = 14;
Hour = 1;

function run_time() {
	if(Second == 0 && Minute == 0) {
		Second = 59;
		Minute = 59;
		Hour = 0;
	} else if(Second == 0) {
		Second = 59;
		Minute--;
	} else {
		Second--;
	}
	if(Second < 10) Second = "0" + parseInt(Second);
	if(Minute < 10) Minute = "0" + parseInt(Minute);
	if(Hour < 10) Hour = "0" + parseInt(Hour);
	document.getElementById("second").innerHTML = Second;
	document.getElementById("minute").innerHTML = Minute;
	document.getElementById("hour").innerHTML = Hour;
	remain_time = setTimeout("run_time()", "1000");
}
remain_time = setTimeout("run_time()", "1000");
//轮播图结束
/*
var button = document.getElementById("Carousel");
changeStyleEveryClick(button, "changeStyle_hidden");
// 封装一个函数，处理类似的情况
function changeStyleEveryClick(element, className) {
	element.addEventListener("mouseover", function() {
		element.classList.add(className);
	}, false);
	element.addEventListener("animationend", function() {
		element.classList.remove(className);
	}, false);
}
*/